<script setup>
const props = defineProps({
  new: {
    type: Object,
  },
})
</script>

<template>
  <div class="container">
    <div class="pic">
      <img :src="props.new.imgUrl" alt="文章封面" />
    </div>
    <div class="text">
      <h3>{{ props.new.title }}</h3>
      <p>{{ props.new.intro }}</p>
      <div>{{ props.new.date }}</div>
    </div>
  </div>
</template>

<style scoped lang="less">
.container {
  display: flex;
  padding: 10px;
  margin-bottom: 10px;
  height: 170px;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 10px;
  box-shadow: 3px 3px 8px #ccc;
  cursor: pointer;
  overflow: hidden;
  &:hover .pic img {
    transform: scale(1.1);
    transition: all 0.3s ease;
  }
  &:hover h3 {
    color: #05b1ec;
  }
  .pic {
    width: 280px;
    height: 140px;
    border-radius: 10px;
    overflow: hidden;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .text {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px 30px 20px;
    height: 160px;
    h3 {
      margin: 0;
      padding: 0;
    }
    p {
      margin-top: 10px;
      overflow: hidden;
      max-height: 4.5em;
      line-height: 1.5;
      text-overflow: ellipsis;
      &::after {
        content: '';
        margin-top: 0.5em;
      }
    }
    div {
      text-align: end;
    }
  }
}
</style>
